<template>
	<view class="main_box">
		<view class="fix_title">
			7/8签约快捷支付
		</view>
		<view class="txt">
			请仔细阅读以下信息并确认
		</view>
		<view class="warn">
			<view class="img">
				<image src="/static/images/blank/atton.png" mode=""></image>
			</view>
			<view class="texts">
				授权及免责声明：开通后您将允许学校代扣该账户资金用于
				支付用户校园消费，并确认将此账户作为校园的扣费账户
			</view>
		</view>
		<view class="card">
			<view class="pos_top">
				<view class="title">
					<view class="img">
						<image src="/static/images/blank/4341.png" mode=""></image>
					</view>
					<view class="text">
						校园电子钱包
					</view>
				</view>
				<view class="user">
					账号
				</view>
				<view class="number">
					{{userInfo.cardNo}}
				</view>
				<template v-if="userInfo.accountType!=2">
					<view class="tips">
						可用余额(元)
					</view>
					<view class="sum">
						{{userInfo.balance}}
					</view>
				</template>
				
			</view>
			<image src="/static/images/blank/bacg.png" mode=""></image>
		</view>
		<view class="promis">
			<view @click="myselfAgree" :class="flag?'cricle':'solid'"></view>
			<view class="xieyi">
				<text>我已阅读<text @click="toExpare()">《交通银行快捷支付服务协议》</text></text>
			</view>

		</view>
		<view class="btn" @click="toNext">
			下一步
		</view>
		<view class="kdn">
			<image src="/static/images/blank/4341yu.png" mode=""></image>
			<view class="subx">
				交通银行 提供产品服务
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getPhoneCode,
		getTwoUserList,
		getMoneny,
		idCardOCR,
		quickPaymentSendCode,
		quickPaymentSuccess
	} from '../../common/api/blank.js';
	import {
		_showLoading,
		_showToast
	} from '../../common/js/util.js'
	export default {
		data() {
			return {
				stuList: [{
					schoolNumber: "申能达商学院",
					name: "张思",
					cardNum: "00089889"
				}],
				userInfo: {},
				flag: true,
				mobileNo: "",
				certNo: "",
				accountNo: "",
				accountName: "",
				light: "",
				orgId: "",
				batId: ""
			}
		},
		onBackPress(options) {
			if (options.from === 'navigateBack') {
				return false
			}
			this.back();
			return true
		},
		async onLoad(option) {
			this.orgId = option.orgId
			this.batId = option.batId
			uni.showLoading({
				title: "获取信息中"
			})
			try {
				const res = await getMoneny({
					batId: option.batId,
					orgId: this.orgId
				})
				console.log(res)
				if (res.code == 0) {
					console.log(res.data)
					this.userInfo = res.data
					uni.hideLoading()
				} else {
					uni.hideLoading()
					_showToast(res.msg)
				}
			} catch (err) {
				uni.hideLoading()
				_showToast(err)
			}

		},
		components: {

		},
		methods: {
			toExpare() {
				uni.navigateTo({
					url: "/pageBlank/components/agreement?url=quickyly.html&title=交通银行快捷支付服务协议"
				})
			},
			back() {
				var pages = getCurrentPages();
				uni.navigateBack({
					delta: pages.length - 2
				})
			},
			myselfAgree() {
				this.flag = !this.flag
			},
			//完成
			async toNext() {
				if (!this.flag) {
					uni.showLoading({
						title: '发送中'
					})
					try {
						const res = await quickPaymentSendCode({
							batId: this.batId,
							orgId: this.orgId
						})
						console.log(res)
						if (res.code === 0) {
							if (res.data.responseStatus === 'S') {
								uni.hideLoading()
								uni.navigateTo({
									url: `/pageBlank/contracting/contracting?signMsgMerTranNo=${res.data.signMsgMerTranNo}&batId=${this.batId}&phone=${this.userInfo.phone}&orgId=${this.orgId}`
								})
							}
							if (res.data.responseStatus === 'F') {
								uni.hideLoading()
								_showToast(res.data.responseMsg)
							}

						} else {
							uni.hideLoading()
							_showToast(res.msg)
						}
					} catch (err) {
						uni.hideLoading()
						_showToast(err)
					}

				} else {
					_showToast("还未同意协议")
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.main_box {
		padding: 24upx;
		box-sizing: border-box;
		overflow-y: auto;

		.kdn {
			margin: 86rpx 0rpx;
			width: 100%;
			display: flex;
			justify-content: center;
			align-items: center;

			>image {
				width: 34rpx;
				height: 33rpx;
			}

			.subx {
				margin-left: 8rpx;
				height: 34rpx;
				font-size: 24rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #003A79;
				line-height: 34rpx;
			}
		}

		.promis {
			display: flex;
			justify-content: space-between;
			margin-bottom: 60rpx;

			.xieyi {
				width: 649rpx;
				margin-left: 10rpx;
				height: auto;
				display: flex;

				>text {
					font-size: 24rpx;
					font-family: Segoe UI-Regular, Segoe UI;
					font-weight: 400;
					color: #475263;
					display: flex;

					text {
						font-size: 24rpx;
						font-family: SFProText-Semibold-, SFProText-Semibold;
						font-weight: normal;
						color: #3F9BFB;
					}
				}
			}


			.cricle {
				width: 26rpx;
				height: 26rpx;
				opacity: 1;
				border: 1rpx solid #3478F5;
				border-radius: 50%;
				margin-top: 6rpx;
				margin-left: 22rpx;
			}

			.solid {
				width: 18rpx;
				height: 18rpx;
				opacity: 1;
				border: 8rpx solid #3478F5;
				border-radius: 50%;
				margin-top: 6rpx;
				margin-left: 22rpx;
			}

		}

		.card {
			width: 676rpx;
			height: 374rpx;
			margin: 0 auto;
			position: relative;
			box-sizing: border-box;
			padding-left: 30rpx;
			padding-top: 25rpx;
			margin-bottom: 100rpx;

			>image {
				width: 100%;
				height: 100%;
				position: absolute;
				top: 0rpx;
				left: 0rpx;
				z-index: 4;
			}

			.pos_top {
				position: absolute;
				z-index: 5;

				.user {
					height: 32rpx;
					font-size: 26rpx;
					font-family: Source Han Sans CN-Light, Source Han Sans CN;
					font-weight: 300;
					color: #FFFFFF;
					line-height: 32rpx;
					margin-bottom: 6rpx;

				}

				.number {
					height: 40rpx;
					font-size: 36rpx;
					font-family: Source Han Sans CN-Light, Source Han Sans CN;
					font-weight: 300;
					color: #FFFFFF;
					line-height: 40rpx;
					margin-bottom: 21rpx;
				}

				.sum {
					height: 66rpx;
					font-size: 48rpx;
					font-family: Source Han Sans CN-Bold, Source Han Sans CN;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 66rpx;
				}

				.tips {
					height: 32rpx;
					font-size: 26rpx;
					font-family: Source Han Sans CN-Light, Source Han Sans CN;
					font-weight: 300;
					color: #FFFFFF;
					line-height: 32rpx;
					margin-bottom: 6rpx;
				}

				.title {
					height: 34rpx;
					display: flex;
					align-items: center;
					margin-bottom: 23rpx;

					.img {
						image {
							width: 34rpx;
							height: 34rpx;

						}
					}

					.text {
						margin-left: 8rpx;
						height: 34rpx;
						font-size: 24rpx;
						font-family: Source Han Sans CN-Light, Source Han Sans CN;
						font-weight: 300;
						color: #FFFFFF;
						line-height: 34rpx;
					}

				}
			}
		}

		.warn {
			display: flex;
			align-items: center;
			margin-left: 32rpx;
			margin-bottom: 53rpx;

			.img {
				width: 40rpx;
				height: 40rpx;
				margin-right: 11rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.texts {
				width: 624rpx;
				font-size: 24rpx;
				font-family: Source Han Sans CN-Light, Source Han Sans CN;
				font-weight: 300;
				color: #DF3A3A;

			}
		}

		.btn {
			width: 358rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			background: #3478F5;
			box-shadow: 0rpx 3rpx 26rpx 1rpx rgba(55, 98, 244, 0.58);
			border-radius: 44rpx 44rpx 44rpx 44rpx;
			opacity: 1;
			font-size: 32rpx;
			font-family: Source Han Sans CN-Light, Source Han Sans CN;
			font-weight: 300;
			color: #FFFFFF;
			margin: 0 auto;
		}

		.fix_title {
			margin: 30upx 0 60upx 0;
			font-size: 40upx;
			font-weight: bolder;
			display: flex;
			align-items: center;
			margin-left: 10rpx;

			&::before {
				content: '';
				height: 36upx;
				width: 12upx;
				background-image: linear-gradient(to bottom, #c3defc, #007AFF);
				margin-right: 12upx;
				border-radius: 6upx;
			}
		}

		.txt {
			height: 46rpx;
			font-size: 32rpx;
			font-family: Source Han Sans CN-Medium, Source Han Sans CN;
			font-weight: 500;
			color: #020202;
			line-height: 46rpx;
			margin-bottom: 68rpx;
			margin-left: 32rpx;
			margin-top: 56rpx;

		}
	}
</style>
